
package ResImpl;

// The log object for restoring and logging Middleware actions.

public class Log implements java.io.Serializable
{
	// The transaction ID and the action defined by an integer and interpreted by the MiddlewareServer
	private int xID;
	private int command;

	// Used for all types of transactions; unused fields are set to default/null values and ignored.
	public Log( int transactionId, int command)
	{
		this.xID = transactionId;
		this.command = command;
	}

	public String toString() {
		int act;
		String line = "xID: " + this.xID + ", command: ";
		if(command == 0) {
			line = line + "COMMIT";
		} else {
			line = line + "ABORT";
		}


		return line;
	}

	public int getXID() {
		return this.xID;
	}
	
	public void setResult(int result) {
		this.command = result;
	}

	public int getResult() {
		return this.command;
	}

}
